﻿using System;

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define null ((void *)0)
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: The following #define macro was replaced in-line:
//ORIGINAL LINE: #define vmpt_real(type, p) ((type *)((vm->cpu->mem->buffer) + (p)))



public unsafe struct elf_head_t
{
	//魔术字段
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 NOTE: Classes must be named in C#, so the following class has been named AnonymousClass:
	public struct AnonymousClass
	{
		public fixed sbyte type [4]; //7f 45 4c 46
		public byte bits; //是多少位的，01:32位，02:64位
		public byte endian; //小端还是大端，01:小端，02:大端
		public byte version; //版本号，一般是01
		public fixed byte reserve[8]; //保留
	}
	public AnonymousClass magic ;

	public ushort e_type; //类型, 01: ET_REL(可重定位文件，一般位.o文件), 02: ET_EXEC(可执行文件), 03: ET_DYN(共享目标文件，一般位.so文件)
	public ushort e_machine; //系统架构
	public uint e_version; //版本号
	public uint e_entry; //入口点地址
	public uint e_phoff; //程序头位置
	public uint e_shoff; //段头位置
	public uint e_flags; //标记
	public ushort e_ehsize; //当前头的大小
	public ushort e_phentsize; //程序头大小
	public ushort e_phnum; //程序头数量
	public ushort e_shentsize; //段头大小
	public ushort e_shnum; //段头数量
	public ushort e_shstrndx; //段头字符串表的位置

}

//段表结构
public struct elf_sec_head_t
{
	public uint sh_name; //section的名字
	public uint sh_type; //section类别
	public uint sh_flags; //section在进程中执行的特性（读、写）
	public uint sh_addr; //在内存中开始的虚地址
	public uint sh_offset; //此section在文件中的偏移
	public uint sh_size;
	public uint sh_link;
	public uint sh_info;
	public uint sh_addralign;
	public uint sh_entsize;
}

public class elf_t
{
	public FILE fp;
}